-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent new RentPaying state created by paying fees #23358
Merged
CriesofCarrots
merged 4 commits into
solana-labs:master
from
CriesofCarrots:rent-paying-fee-payer
Feb 26, 2022
Merged
Prevent new RentPaying state created by paying fees #23358
CriesofCarrots
merged 4 commits into
solana-labs:master
from
CriesofCarrots:rent-paying-fee-payer
Feb 26, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jstarry
previously approved these changes
Feb 26, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a few nits
mergify
bot
dismissed
jstarry’s stale review
February 26, 2022 03:58
Pull request has been modified.
CriesofCarrots
force-pushed
the
rent-paying-fee-payer
branch
from
February 26, 2022 04:01
3ea1087
to
f41196b
Compare
CriesofCarrots
force-pushed
the
rent-paying-fee-payer
branch
from
February 26, 2022 04:36
f41196b
to
b06bde0
Compare
Codecov Report
@@ Coverage Diff @@
## master #23358 +/- ##
========================================
Coverage 81.3% 81.4%
========================================
Files 572 572
Lines 155874 156057 +183
========================================
+ Hits 126823 127031 +208
+ Misses 29051 29026 -25 |
mergify bot
pushed a commit
that referenced
this pull request
Feb 26, 2022
* Add failing test * Check fee-payer rent-state change on load * Add more test cases * Review comments (cherry picked from commit 36484f4) # Conflicts: # runtime/src/account_rent_state.rs
mergify bot
added a commit
that referenced
this pull request
Feb 26, 2022
…#23360) * Prevent new RentPaying state created by paying fees (#23358) * Add failing test * Check fee-payer rent-state change on load * Add more test cases * Review comments (cherry picked from commit 36484f4) # Conflicts: # runtime/src/account_rent_state.rs * Fix conflicts Co-authored-by: Tyera Eulberg <[email protected]>
jeffwashington
pushed a commit
to jeffwashington/solana
that referenced
this pull request
Mar 4, 2022
* Add failing test * Check fee-payer rent-state change on load * Add more test cases * Review comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Because fees are deducted on account load, before transaction execution, the RentPaying-transition checks from #22292 do not catch accounts that are left in a newly RentPaying state due to fees.
Summary of Changes
Call a version of
check_rent_state()
from Accounts::load_transaction, and fail invalid rent-state transitions the same way as other fee-account failures.Note: generally, transactions that take an account to an Uninitialized state are allowed. However, this changeset fails transactions wherein a fee-payer account has a small enough balance that the fee would make the account RentPaying and the transaction would empty the account. This is because we need to check fee-payers before we know what would happen in the transaction. This seems okay to me, but curious to hear your thoughts, or if you can see a quick workaround.
Fixes #23342